package com.cos66.Impl;

import java.io.File;
import java.util.List;

import android.content.Context;
import android.widget.ListView;

import com.cos66.R;
import com.cos66.adapters.MagazineAdapter;
import com.cos66.intf.FileCallBack;
import com.cos66.model.MagazineItem;
import com.cos66.store.MagazineListDataFromXml;

public class DataFromXml implements FileCallBack {
	
	private Context context;
	private ListView listView;

	public DataFromXml(Context context, ListView listView){
		this.context = context;
		this.listView = listView;
	}
	
	public void onFileCreate(File file) {
		// TODO Auto-generated method stub
		MagazineListDataFromXml dataFromXml = new MagazineListDataFromXml(file);
		List<MagazineItem> data = dataFromXml.getData();
		MagazineAdapter adapter = new MagazineAdapter(context, data,
				R.layout.magazine_item);
		listView.setAdapter(adapter);
	}

}
